<?php
class sprache {
	
	function spracheWaehlen() {
		if(isset($_GET['lang'])) {
			$this->lang = $_GET['lang'];
			$_SESSION['lang'] = $this->lang;
			setcookie('lang', $this->lang, time() + (3600 * 24 * 30));
		}
		elseif (isset($_SESSION['lang'])) {
			$this->lang = $_SESSION['lang'];
		}
		elseif (isset($_COOKIE['lang'])) {
			$this->lang = $_COOKIE['lang'];
		}
		else {
			$this->lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2);
		}
		
		switch($this->lang) {
			case 'de':
				$sprachenfile = adminsettings::sprachenpfad."lang.de.php";
				break;
			case 'en':
				$sprachenfile = adminsettings::sprachenpfad."lang.en.php";
				break;
			case 'fr':
				$sprachenfile = adminsettings::sprachenpfad."lang.fr.php";
				break;
			default:
				$sprachenfile = adminsettings::sprachenpfad."lang.de.php";
				break;
		}
		return $sprachenfile;
	}
}
?>